<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <link rel="shortcut icon" type="image/x-icon" th:href="@{/img/car.png}">
    <meta charset="utf-8"/>
    <title>购物车</title>
    <link rel="stylesheet" type="text/css" th:href="@{/css/shopping-cars.css}" href="css/shopping-cars.css"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/reset.css}" href="css/reset.css"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/swiper-4.3.5.min.css}" href="css/swiper-4.3.5.min.css"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/head.css}" href="css/head.css"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/footer.css}" href="css/footer.css"/>
</head>

<body>
<div th:replace="head::topbar"></div>
<div class="coupon-line">
    <div class="title-line fl">
        <div class="photo-line fl">
            <img th:src="@{/img/pic-1.png}"/>
        </div>
        <span class="coupon-name-line fl">购物车可领优惠券</span>
        <div class="clear"></div>
    </div>
    <div class="check-line fr">
        <span>查看优惠券</span>
        <img class="price-line" th:src="@{/img/pic-2.png}"/>
    </div>
    <div class="check-two-line fr">

        <span>查看优惠券</span>
        <img class="price2-line" th:src="@{/img/pic-3.png}"/>

    </div>
    <div class="clear"></div>
</div>
<div class="bd-bdline">
    <div class="nameline">
        暂时没有优惠券
    </div>
</div>
<div class="content">
    <div class="container">
        <div class="container-top">
            <div class="coupon">
                <div class="title fl">
                    <div class="photo fl">
                        <img th:src="@{/img/pic-1.png}"/>
                    </div>
                    <span class="coupon-name fl">购物车可领优惠券</span>
                    <div class="clear"></div>
                </div>
                <div class="check fr">

                    <span>查看优惠券</span>
                    <img class="price" th:src="@{/img/pic-2.png}"/>
                </div>
                <div class="check-two fr">
                    <span>查看优惠券</span>
                    <img class="price2" th:src="@{/img/pic-3.png}"/>
                </div>
                <div class="clear"></div>
            </div>
            <div class="bd">
                <div class="name">
                    <div class="name-left fl">
                        <ul>
                            <li class="lisstt">可领取</li>
                            <li>已领取</li>
                        </ul>
                    </div>
                    <span>暂时没有优惠券</span>
                    <div class="clear"></div>
                    <div class="name-left fl">

                    </div>
                </div>
            </div>
            <form action="/indent/deal_indent" method="post">
                <input type="hidden" name="customerId" th:value="${session.customerId}"/>
                <input id="indentprice" type="hidden" name="" value=""/>
                <div class="list">
                    <div class="information">
                        <div class="Commodity-information">
                            <div class="w-w1 fl">
                                <input type="checkbox" class="checkbox fl" th:id="allcheck"/>
                                <label class="all fl" th:for="allcheck">全选</label>
                                <div class="clear"></div>
                            </div>
                            <div class="w-w2 fl">
                                <span class="all fl">商品信息</span>
                                <div class="clear"></div>
                            </div>
                            <div class="w-w3 fl">
                                <span class="all">单价</span>
                            </div>
                            <div class="w-w4 fl">
                                <span class="all">数量</span>
                            </div>
                            <div class="w-w6 fr">
                                <span class="all fl">操作</span>
                                <div class="clear"></div>
                            </div>
                            <div class="w-w5 fr">
                                <span class="all fr">小计</span>
                                <div class="clear"></div>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                    <div class="cart-group">
                        <div class="promotion-wrap">
                            <span class="premium">全场加价购</span>
                            <span class="meet">已满足【满130元可超值换购】</span>
                            <a class="buy" href="index.html">去换购</a>
                            <a class="continue" href="index.html">继续凑单>></a>
                        </div>
                    </div>
                    <ul class="cart-grouplist">
                        <li th:each="s,itemStat:${shoppingCarts}" class="cart-grouplist-li">
                            <div class="list-list">
                                <div class="buttona fl">
                                    <input type="checkbox" class="checkbox wojiade" name="checkboxs" th:value="${s.product.productId}" checked="true"
                                           th:id="${s.getCartId()}"/>
                                </div>
                                <div class="photo fl">
                                    <img th:src="@{${s.product.imgSrc}}"/>
                                </div>
                                <div class="nameCon fl">
                                    <a class="sleep-yi" href="goods-details3.html"
                                       th:text="${s.product.productName}"></a>
                                    <div class="color">
                                        <a href="#">便携带 白色</a>
                                    </div>
                                </div>
                                <span class="pricea fl">￥</span>
                                <span class="priceb fl danjia" th:text="${s.product.productPrice}"></span>
                                <div class="u-selnum fl woxiede">

                                    <span class="reduction fl">-</span>
                                    <input class="j-input fl " type="text" name="counts" th:value="${s.productCount}"/>
                                    <span class="sign fl">+</span>
                                    <div class="clear"></div>
                                    <input type="hidden" class="kucun" th:value="${s.product.productCount}" />

                                </div>
                                <span class="price11 fl">￥</span>
                                <span class="priceb fl xiaoji"
                                      th:text="${s.product.productPrice}*${s.productCount}"></span>
                                <div class="move-del fl">
                                    <span class="move fl">移入收藏夹</span>
                                    <div class="delect" th:id="${s.getCartId()}">
                                        删除
                                    </div>
                                    <div class="clear"></div>
                                </div>
                                <div class="clear"></div>
                            </div>
                        </li>
                    </ul>
                    <div class="cart-grouplisttwo">
                        <div class="cart-grouplisttwo-con">
                            <img th:src="@{/img/pic-26_03.jpg}"/>
                            <div class="cart-grouplisttwo-name">
                                <span>购物车还是空的，小主人，嘤嘤嘤！</span>
                            </div>
                            <div class="cart-grouplisttwo-contine">
                                <a href="/">继续逛</a>
                            </div>

                        </div>
                    </div>
                    <div class="combined">
                        <input type="hidden">
                        <div class="combined-del">
                            <input type="checkbox" class="checkbox"/>
                            <span class="selected">已选(</span>
                            <span class="nums"></span>
                            <span>)</span>
                            <p class="batch-del" href="#">批量删除</p>
                            <p class="value-sha" href="#">清空失效商品</p>
                        </div>
                        <div class="combined-button fr">
                            <button type="submit" id="dealIndent">下单</button>
                        </div>
                        <div class="cost fr">
                            <div class="shang">
                                <span class="cost-cost" >应付总额：</span>
                                <span class="cost-price1">￥</span>
                                <span class="cost-price" id="indentp">0.00</span>
                            </div>
                            <div class="line-line fr">
                                <a href="goods-details.html">
                                    <span>再购</span>
                                    <span>59.00</span>
                                    <span>免邮，去凑单></span>
                                </a>
                            </div>
                        </div>
                        <div class="activity fr">
                            <div class="activity-line">
                                <span>商品合计：</span>
                                <span class="cost-price" ></span>
                            </div>
                            <div class="activitylist-line">
                                <span>活动优惠：</span>
                                <span>-￥0.00</span>
                            </div>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
            </form>


            <!--第二框-->
            <div class="container-foot">
                <div class="title">
                    <div class="imgWrag">
                        <div class="imgWrag-1 fl">
                            <img class="imgWrag-img" th:src="@{/img/pic-0.png}"/>
                        </div>

                        <span class="imgWrag-name fl">看了该商品的人还买了</span>
                        <div class="clear"></div>
                    </div>

                </div>
                <ul class="m-iteam-list" th:if="${session.recommendProducts}==null">
                    <li>
                        <div class="li-list tran5">
                            <a href="goods-details3.html"><img th:src="@{/img/pic-5.png}"/></a>
                        </div>
                        <div class="discount">
                            <span>满折</span>
                        </div>
                        <div class="clothes">
                            <a href="goods-details3.html"> 车载空气净化器</a>
                        </div>
                        <div class="clothes-price">
                            ￥399
                        </div>
                        <div class="data-rec">

                        </div>
                        <div class="desc-dataname">
                            <span>CADR值高达70m³/h</span>
                        </div>
                    </li>
                    <li>
                        <div class="li-list tran5">
                            <a href="goods-details3.html"><img th:src="@{/img/pic-7.png}"/></a>
                        </div>
                        <div class="discount">
                            <span>满折</span>
                        </div>
                        <div class="clothes">
                            <a href="goods-details3.html">LED光控体感旋转式柜灯/智能小夜灯</a>
                        </div>
                        <div class="clothes-price">
                            ￥78
                        </div>
                        <div class="data-rec">

                        </div>
                        <div class="desc-dataname">
                            <span>多场景应用，可调可旋便捷贴心</span>
                        </div>
                    </li>
                    <li>
                        <div class="li-list tran5">
                            <a href="goods-details3.html"><img th:src="@{/img/pic-9.png}"/></a>
                        </div>
                        <div class="discount">
                            <span>满折</span>
                        </div>
                        <div class="clothes">
                            <a href="goods-details3.html"> 网易智造全方位空气净化器</a>
                        </div>
                        <div class="clothes-price">
                            ￥1799.1
                        </div>
                        <div class="data-rec">

                        </div>
                        <div class="desc-dataname">
                            <span>360°立体风洞循环，400m³/h高能效净化！</span>
                        </div>
                    </li>
                    <li>
                        <div class="li-list tran5">
                            <a href="goods-details3.html"><img th:src="@{/img/pic-10.png}"/></a>
                        </div>
                        <div class="discount">
                            <span>满折</span>
                        </div>
                        <div class="clothes">
                            <a href="goods-details3.html"> 网易智造3D可逆循环扇</a>
                        </div>
                        <div class="clothes-price">
                            ￥499
                        </div>
                        <div class="data-rec">

                        </div>
                        <div class="desc-dataname">
                            <span>创新可逆模式 空气对流循环</span>
                        </div>
                    </li>
                    <div class="clear"></div>
                </ul>
                <ul class="m-iteam-list" th:if="${session.recommendProducts}!=null">
                    <li th:each="rp,itemStat :${session.recommendProducts}" th:if="${itemStat.count<=4}">
                        <div class="li-list tran5">
                            <a th:href="@{/product/goods-details(productId=${rp.productId})}"><img th:src="@{${rp.imgSrc}}"/></a>
                        </div>
                        <div class="discount">
                            <span>满折</span>
                        </div>
                        <div class="clothes">
                            <a th:href="@{/product/goods-details(productId=${rp.productId})}" th:text="${rp.productName}"> 车载空气净化器</a>
                        </div>
                        <div class="clothes-price" th:text="${rp.productPrice}">
                            ￥399
                        </div>
                        <div class="data-rec">

                        </div>
                        <div class="desc-dataname" th:text="${rp.productDescribe}">
                            <span>CADR值高达70m³/h</span>
                        </div>
                    </li>
                    <div class="clear"></div>
                </ul>
                <div class="title">
                    <div class="imgWrag">
                        <div class="imgWrag-1 fl">
                            <img class="imgWrag-img" th:src="@{/img/pic-5.png}"/>
                        </div>

                        <span class="imgWrag-name fl">看了该商品的人还买了</span>
                        <div class="clear"></div>
                    </div>

                </div>
                <ul class="m-iteam-list" th:if="${session.recommendProducts}==null">
                    <li>
                        <div class="li-list tran5">
                            <a href="goods-details3.html"><img th:src="@{/img/pic-11.png}"/></a>
                        </div>
                        <div class="discount">
                            <span>满折</span>
                        </div>
                        <div class="clothes">
                            <a href="goods-details3.html"> 电子防盗保险箱</a>
                        </div>
                        <div class="clothes-price">
                            ￥1399
                        </div>
                        <div class="data-rec">

                        </div>
                        <div class="desc-dataname">
                            <span>CCC认证,指纹密码，稳妥守护重要物件</span>
                        </div>
                    </li>
                    <li>
                        <div class="li-list tran5">
                            <a href="goods-details3.html"><img th:src="@{/img/pic-12.png}"/></a>
                        </div>
                        <div class="discount">
                            <span>满折</span>
                        </div>
                        <div class="clothes">
                            <a href="goods-details3.html"> 音伏IN-VOICE 头戴音乐耳机</a>
                        </div>
                        <div class="clothes-price">
                            ￥399.2
                        </div>
                        <div class="data-rec">

                        </div>
                        <div class="desc-dataname">
                            <span>回归本质，聆听内心</span>
                        </div>
                    </li>
                    <li>
                        <div class="li-list tran5">
                            <a href="goods-details3.html"><img th:src="@{/img/pic-13.png}"/></a>
                        </div>
                        <div class="discount">
                            <span>满折</span>
                        </div>
                        <div class="clothes">
                            <a href="goods-details3.html"> 音伏IN-VOICE 动圈高保真耳机</a>
                        </div>
                        <div class="clothes-price">
                            ￥79
                        </div>
                        <div class="data-rec">

                        </div>
                        <div class="desc-dataname">
                            <span>强劲低频，澎湃低音</span>
                        </div>
                    </li>
                    <li>
                        <div class="li-list tran5">
                            <a href="goods-details3.html"><img th:src="@{/img/pic-14.png}"/></a>
                        </div>
                        <div class="discount">
                            <span>满折</span>
                        </div>
                        <div class="clothes">
                            <a href="goods-details3.html"> 随卷随心电动造型器</a>
                        </div>
                        <div class="clothes-price">
                            ￥203.1
                        </div>
                        <div class="data-rec">

                        </div>
                        <div class="desc-dataname">
                            <span>纳米陶瓷涂层，智能恒温不伤发</span>
                        </div>
                    </li>
                    <div class="clear"></div>
                </ul>
                <ul class="m-iteam-list" th:if="${session.recommendProducts}!=null">
                    <li th:each="rp,itemStat :${session.recommendProducts}" th:if="${itemStat.count>4&&itemStat.count<=8}">
                        <div class="li-list tran5">
                            <a th:href="@{/product/goods-details(productId=${rp.productId})}"><img th:src="@{${rp.imgSrc}}"/></a>
                        </div>
                        <div class="discount">
                            <span>满折</span>
                        </div>
                        <div class="clothes">
                            <a th:href="@{/product/goods-details(productId=${rp.productId})}" th:text="${rp.productName}"> 车载空气净化器</a>
                        </div>
                        <div class="clothes-price" th:text="${rp.productPrice}">
                            ￥399
                        </div>
                        <div class="data-rec">

                        </div>
                        <div class="desc-dataname" th:text="${rp.productDescribe}">
                            <span>CADR值高达70m³/h</span>
                        </div>
                    </li>
                    <div class="clear"></div>
                </ul>
            </div>
        </div>
    </div>

</div>
<div th:replace="footer::#footbar"></div>

<script th:src="@{/js/jquery-3.3.1.min.js}" src="js/jquery-3.3.1.min.js" type="text/javascript"
        charset="utf-8"></script>
<script th:src="@{/layer-v3.1.1/layer/layer.js}" src="layer-v3.1.1/layer/layer.js"></script>
<script th:src="@{/js/swiper-4.3.5.min.js}" type="text/javascript" src="js/swiper-4.3.5.min.js"></script>

<!--开始加载-->
<script type="text/javascript">
    $(document).ready(function () {
        //底部侧边栏关闭
        $(".icon-sidebarx").click(function () {
            $(this).parents(".sidebar-b-bac").remove();
        });

        if ($('.cart-grouplist').children('li').length == 0) {
            $('.cart-grouplisttwo').css("display", "block");
            $('#dealIndent').attr("disabled","disabled");
        }

        //右边侧边栏关闭
        $(".icon-subx").click(function () {
            $(this).parents(".sub-list").css("display", "none");
        });
        //右边hover弹窗input隐藏出现
        $(".sub-inputbox").click(function () {
            $(this).prev(".icon-inputx").css("opacity", 1);
        });
        //下拉到200px侧边栏出现回到顶部且导航栏出现，上啦消失，且导航栏消失
        $(window).scroll(function () {
            var top = $(document).scrollTop();
            if (top > 200) {
                $(".sidebar-r-totop").css({
                    display: 'block'
                });
                $(".navigation-fix").slideDown();
            } else {
                $(".sidebar-r-totop").css({
                    display: 'none'
                });
                $(".navigation-fix").slideUp();
            }
        });
        //点击回到顶部，回到顶部
        $(".sidebar-r-totop").click(function () {
            $("html,body").animate({
                scrollTop: 0
            }, 500);
        });

    })
</script>
<!--开始加载-->

<!--点击事件-->
<script type="text/javascript">

    //form表单的submit事件
    $("form").submit(function(){
        //alert($('form').find('input[class*=j-input]').val());
        $('.wojiade').each(function () {
            var i=$(this).val();
            var j=$(this).parent().siblings('.woxiede').find('input').val();
            $(this).val(i+'_'+j);
            // alert($(this).val());
        })
        $("#indentprice").val($("#indentp").text())
    });

    $(window).scroll(function () {
        var top = $(document).scrollTop();
        if (top > 500) {
            $(".coupon-line").css({
                display: 'block'
            });
            $(".coupon-line").slideDown();
        } else {
            $(".coupon-line").css({
                display: 'none'
            });
            $(".bd-bdline").css({
                display: 'none'
            });

            $(".coupon-line").slideUp();
        }
    });
    //第一步这是优惠券点击事件。。。
    $(".bd").css("display", "none");
    $(".check-two").css("display", "none");
    $(".check").click(function () {
        $(this).parent().siblings(".bd").css("display", "block");
        $(this).parent().siblings(".qqqqqqq").css("top", "207px");
        $(this).css("display", "none");
        $(".check-two").css("display", "block");
    });
    $(".check-two").click(function () {
        $(this).parent().siblings(".bd").css("display", "none");
        $(this).parent().siblings(".qqqqqqq").css("top", "50px");
        $(this).css("display", "none");
        $(".check").css("display", "block");
    });

    $(".check-two-line").css("display", "none");
    $(".check-line").click(function () {
        $(".check-two-line").css("margin-right", "148px");
        $(this).parent().siblings(".bd-bdline").css("display", "block");
        /*$(this).parent().siblings(".qqqqqqq").css("top", "207px");*/
        $(this).css("display", "none");
        $(".check-two-line").css("display", "block");
    });
    $(".check-two-line").click(function () {
        $(this).parent().siblings(".bd-bdline").css("display", "none");
        /*$(this).parent().siblings(".qqqqqqq").css("top", "50px");*/
        $(this).css("display", "none");
        $(".check-line").css("display", "block");
    });
    //点击批量删除-----------------------
    var cartId = new Array();
    $(".batch-del").click(function () {

        var checkboxs = $(".wojiade");

        checkboxs.each(function () {

            if ($(this).prop("checked")) {

                cartId.push($(this).attr("id"));

            }
        });
        //alert(cartId)
        layer.confirm('确定删除吗？', function (index) {
            $.ajax({
                url: '/shoppingcart/multiDel',
                data: {
                    ids: cartId.join(',')
                },
                method: 'GET',
                traditional: true,
                success: function (json) {
                    layer.msg('已删除');
                    mdel();
                }
            });
        });

    });

    function mdel() {

        for (var i = 0; i < cartId.length; i++) {
            $("#" + cartId[i]).parents('.cart-grouplist-li').remove();
        }
        if ($('.cart-grouplist').children('li').length == 0) {
            $(".batch-del").parents(".combined").remove();
            $('.cart-grouplisttwo').css("display", "block");
        }

    }

    //点击批量删除-----------------------
    $(".value-sha").click(function () {
        //配置一个透明的询问框
        layer.msg('客官，没有失效商品啊！', {
            time: 4000, //2s后自动关闭

        });
    });

    //添加事件委托删除
    $("ul").on("click", ".delect", function () {
        $(this).parents('li').remove();
        var i = $(".cart-grouplist li").length;
        console.log(i)
        if (i == 0) {
            $(".combined").remove();
            $('.cart-grouplist').remove();
            $('.cart-grouplisttwo').css("display", "block");
        }

        var data = this.val;

    });
    //添加事件委托移入
    $("ul").on("click", ".move", function () {
        $(this).parents('li').remove();
        var i = $(".cart-grouplist li").length;
        console.log(i)
        if (i == 0) {
            $(".combined").remove();
            $('.cart-grouplist').remove();
            $('.cart-grouplisttwo').css("display", "block");
        }

    });

    //单个删除在这！----------------------------------------
    $(function () {
        // adddel();
        //点击删除事件，用each循环，并借机调用sumPrice();
        $(".delect").each(function () {
            $(this).click(function () {
                $(this).parents('li').remove();
                if ($(".cart-grouplist li").length == 0) {
                    $(".cost-price").text(0);
                }
                del($(this).attr("id"));

                /*sumPrice();*/
            });
        });

        function showShoppingCarts() {
            $.ajax({
                url: '/shoppingcart/cars', //teacherUserController
                method: 'GET',
                traditional: true
            });
        }

        function del(id) {
            // var data = $(this).parent(".delect1").firstChild.text();
            // alert(data);

            $(this).parents("li").remove();
            $.ajax({
                url: '/shoppingcart/del_cars', //teacherUserController
                data: {
                    'cartId': id
                },
                method: 'GET',
                traditional: true,
                success: function (msg) {
                    layer.msg(msg);
                    showShoppingCarts();

                },
                error: function (msg) {
                    layer.msg(msg);
                }
            });
            $(this).parent(".delect1").remove();
        }

        //单个删除在这！----------------------------------------


        $(".cart-grouplist li").each(function () {
            $(".delect").click(function (id) {
                var i = $(".cart-grouplist li").length;
                console.log(i)
                if (i == 0) {

                    $(".combined").remove();
                    $('.cart-grouplist').remove();
                    $('.cart-grouplisttwo').css("display", "block");
                }
                $.ajax({
                    url: '/shoppingcart/del_cars', //teacherUserController
                    data: {
                        'cartId': id
                    },
                    method: 'GET',
                    traditional: true,
                    success: function (msg) {
                        layer.msg(msg);
                        showShoppingCarts();

                    },
                    error: function (msg) {
                        layer.msg(msg);
                    }
                });
                /*sumPrice();*/
            });
        });
        //点击移入事件
        $(".move").each(function () {
            $(this).click(function () {
                $(this).parents('li').remove();
                if ($(".cart-grouplist li").length == 0) {
                    $(".cost-price").text(0);
                }
                /*sumPrice();*/
            });
        });
        $(".cart-grouplist li").each(function () {
            $(".move").click(function () {
                var i = $(".cart-grouplist li").length;
                console.log(i)
                if (i == 0) {
                    $(".combined").remove();
                    $('.cart-grouplist').remove();
                    $('.cart-grouplisttwo').css("display", "block");
                }
            });
        });
    });

</script>

<script type="text/javascript">
    var swiper = new Swiper('.swiper-container', {
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },
    });
</script>

<!--全选按钮-->
<script type="text/javascript">
    var flag = true;
    $("#allcheck").click(function () {
        if (flag) {
            $(".cart-grouplist li").find("input[type=checkbox]").prop('checked', false);
            $(".combined-del").find("input[type=checkbox]").prop('checked', false);
            flag = true;
            $(".cost-price").text("0.00");
            $(".nums").text("0");
            /*$(".cart-grouplist li").find("input[type=checkbox]").prop('checked', true);*/
            flag = false;
            /*sumPrice();*/
        } else {
            $(".cart-grouplist li").find("input[type=checkbox]").prop('checked', true);
            $(".combined-del").find("input[type=checkbox]").prop('checked', true);
            /*$(".cart-grouplist li").find("input[type=checkbox]").prop('checked', false);
            $(".combined-del").find("input[type=checkbox]").prop('checked', false);
            flag = true;
            $(".cost-price").text("0.00");*/
            flag = true;
            setTotal();
        }

    })

    function setTotal() {
        var s = 0;
        var s1 =0;
        $(".cart-grouplist li").each(function () {
            s += parseInt($(this).find('input[class*=j-input]').val()) * parseFloat($(this).find('span[class*=priceb]').text());
            s1 +=parseInt($(this).find('input[class*=j-input]').val());
        });
        $(".cost-price").html(s.toFixed(2));
        $(".nums").html(s1.toFixed(0));
    }
</script>
<!--全选按钮-->

<script type="text/javascript">
    $(".name-left ul li").click(function () {
        $(".name-left ul li").removeClass('lisstt');
        $(".name-left ul li").removeClass('active'); //必须写参
        $(this).addClass("active");

    });
</script>

<!--check按钮-->
<script type="text/javascript">
    $(".buttona .checkbox").each(function () {
        //alert($(this).prop("checked"));
        $(this).click(function () {
            // alert("我被点击了");
            if ($(this).prop("checked")) {
                //$(this).remove("checked");

                //alert(1);
            } else {
                $("#allcheck").prop('checked', false);
                flag = false;
                //alert("进的这里");
                //setTotalll();
            }
            setTotalll();
        })
    })

    function setTotalll() {
        // var s = 0;
        // $(".cart-grouplist li").each(function() {
        // 	s += parseInt($(this).find('input[class*=j-input]').val()) * parseFloat($(this).find('span[class*=priceb]').text());
        // });
        // $(".cost-price").html(s.toFixed(2));
        //var cartId = new Array();
        //alert("我被调用了");
        var total = 0;
        var total1=0;
        var checkboxs = $(".wojiade");

        checkboxs.each(function () {
            //alert($(this).attr("id"));

            if ($(this).prop("checked")) {
                //alert($(this).attr("checked"));

                total += parseFloat($(this).parent().siblings(".xiaoji").text());
                total1+=parseInt($(this).parent().siblings().find('input[class*=j-input]').val());

                //alert(total);
            }
        });
        $(".cost-price").html(total.toFixed(2));
        $(".nums").html(total1.toFixed(0));

    }

</script>
<!--check按钮-->


<!--***********************商品中的加减号**************************************-->
<script type="text/javascript">
    $(function () {
        $(".sign").click(function () {

            var kucun=$(this).siblings('.kucun').val();
            //alert(kucun)
            var t = $(this).parent().find('input[class*=j-input]');
            if(parseInt(t.val())+1 <= kucun ){
                t.val(parseInt(t.val()) + 1);
                var num = $(this).siblings(".j-input").val();
                $multi = parseFloat(num) * parseFloat($(this).parent().siblings(".priceb").text());
                $(this).parent().siblings(".price1").text(Math.round($multi));

                var xiaoji = parseFloat($(this).parent().siblings(".xiaoji").text()) + parseFloat($(this).parent().siblings(".danjia").text());
                // xiaoji=Math.round(xiaoji*100)/100;
                xiaoji = xiaoji.toFixed(2);
                $(this).parent().siblings('.xiaoji').text(xiaoji);
                setTotal();
            }else layer.msg("库存没有这么多了，亲~")

        })
        $(".reduction").click(function () {

            if ($(this).siblings(".j-input").val() > 1) {
                var xiaoji = parseFloat($(this).parent().siblings(".xiaoji").text()) - parseFloat($(this).parent().siblings(".danjia").text());
                xiaoji = xiaoji.toFixed(2);
                $(this).parent().siblings('.xiaoji').text(xiaoji);
            }
            var t = $(this).parent().find('input[class*=j-input]');
            t.val(parseInt(t.val()) - 1)
            if (parseInt(t.val()) < 1) {
                t.val(1);
            }
            var num1 = $(this).siblings(".j-input").val();
            $multi1 = parseFloat(num1) * parseFloat($(this).parent().siblings(".priceb").text());
            $(this).parent().siblings(".price1").text(Math.round($multi1));

            setTotal();
        })

        function setTotal() {
            var s = 0;
            var s1 = 0;
            $(".cart-grouplist li").each(function () {
                s += parseInt($(this).find('input[class*=j-input]').val()) * parseFloat($(this).find('span[class*=priceb]').text());
                s1+=parseInt($(this).find('input[class*=j-input]').val());
            });
            $(".cost-price").html(s.toFixed(2));
            $(".nums").html(s1.toFixed(0));
        }

        setTotal();
    });
</script>
<!--***********************商品中的加减号 *************************************-->


<script type="text/javascript">
    $(document).ready(function () {
        $(".cart-grouplist li").find("input[type=checkbox]").prop('checked', true);
        $(".w-w1").find("input[type=checkbox]").prop('checked', true);
        $(".combined-del").find("input[type=checkbox]").prop('checked', true);
    })
</script>
</body>

</html>